import service from '@/utils/request.js'

/**
 * 文件上传
 * @param {File} file - 要上传的文件
 * @returns {Promise} - 返回上传结果
 */
export const uploadFile = (file) => {
  const formData = new FormData();
  formData.append('file', file);

  return service({
    url: '/common/upload',
    method: 'POST',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    setting: {
      isToken: true
    }
  });
};
